package api

import (
	"blog/app/service"
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/net/ghttp"
)

func Tag(r *ghttp.Request) {
	tag,ok :=  r.Get("tag").(string)
	if !ok{
		r.Response.Writeln("该栏目不存在！")
		return
	}
	artList :=service.Context.ListTable(r.Context(),tag)
	err := r.Response.WriteTpl("lists.html", g.Map{
		"tid":   tag,  // 当前栏目名
		"artList":   artList,  // 当前栏目文章清单
	})
	if err != nil {
		r.Response.Writeln(err)
		return
	}
}

